package com.piggy.logi.sys.api;

import com.piggy.common.core.constant.SecurityConstants;
import com.piggy.common.core.constant.ServiceNameConstants;
import com.piggy.common.core.domain.R;
import com.piggy.common.core.web.page.TableDataInfo;
import com.piggy.logi.sys.api.bo.LogiPriceSegEditBo;
import com.piggy.logi.sys.api.bo.LogiPriceSegQueryBo;
import com.piggy.logi.sys.api.factory.RemoteLogiPriceSegFallbackFactory;
import com.piggy.logi.sys.api.vo.LogiPriceSegExtVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * 角色服务
 *
 * @author shark
 */
@FeignClient(contextId = "remoteLogiPriceSegService", value = ServiceNameConstants.SYSTEM_LOGI_SERVICE, fallbackFactory = RemoteLogiPriceSegFallbackFactory.class)
public interface RemoteLogiPriceSegService {

    /**
     * 查询分段价格列表
     */
    @GetMapping("/logi/sys/seg/inner/list")
    public TableDataInfo<LogiPriceSegExtVo> innerList(@Validated LogiPriceSegQueryBo bo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 获取分段价格详细信息
     */
    @GetMapping("/logi/sys/seg/inner/{id}")
    public R<LogiPriceSegExtVo> innerInfo(@NotNull(message = "主键不能为空")
                                          @PathVariable("id") Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 新增分段价格
     */
    @PostMapping("/logi/sys/seg/inner/add")
    public R<LogiPriceSegExtVo> innerAdd(@Validated @RequestBody LogiPriceSegEditBo bo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 修改分段价格
     */
    @PostMapping("/logi/sys/seg/inner/edit")
    public R<LogiPriceSegExtVo> innerEdit(@Validated @RequestBody LogiPriceSegEditBo bo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 删除分段价格
     */
    @PostMapping("/logi/sys/seg/inner/remove/{ids}")
    public R<Integer> innerRemove(@NotEmpty(message = "主键不能为空")
                                  @PathVariable(value = "ids") Long[] ids, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


}
